#include "assist.h"

Assist::Assist(QWidget *parent) : QWidget(parent)
{
  //Set back images
  setAutoFillBackground(true);
  QPalette palette;
  palette.setBrush(QPalette::Window, QBrush(QPixmap(":/assist/assist_background")));
  setPalette(palette);

  parkLabel = new QLabel(this);
  reverseLabel = new QLabel(this);
  neutralLabel = new QLabel(this);
  driveLabel = new QLabel(this);
}

void Assist::setAssistMode(Assist::AssistMode mode)
{
  if (mode == Assist::PARK) {
    parkLabel->setPixmap(QPixmap(":/assist/park_red"));
    parkLabel->setScaledContents(true);
    parkLabel->setGeometry(19, 19, 37, 28);
    reverseLabel->setVisible(false);
    neutralLabel->setVisible(false);
    driveLabel->setVisible(false);

  } else if (mode == Assist::REVERSE) {
    parkLabel->setVisible(false);
    neutralLabel->setVisible(false);
    driveLabel->setVisible(false);

    reverseLabel->setVisible(true);
    reverseLabel->setPixmap(QPixmap(":/assist/reverse_sel"));
    reverseLabel->setScaledContents(true);
    reverseLabel->setGeometry(17, 57, 24, 29);

  } else if (mode == Assist::NEUTRAL) {
    parkLabel->setVisible(false);
    reverseLabel->setVisible(false);
    driveLabel->setVisible(false);

    neutralLabel->setVisible(true);
    neutralLabel->setPixmap(QPixmap(":/assist/neutral_sel"));
    neutralLabel->setScaledContents(true);
    neutralLabel->setGeometry(17, 97, 25, 29);

  } else if (mode == Assist::DRIVE) {
    parkLabel->setVisible(false);
    reverseLabel->setVisible(false);
    neutralLabel->setVisible(false);
    driveLabel->setVisible(true);

    driveLabel->setVisible(true);
    driveLabel->setPixmap(QPixmap(":/assist/drive_sel"));
    driveLabel->setScaledContents(true);
    driveLabel->setGeometry(17, 138, 23, 29);
  } else {

  }
}
